#!/bin/sh

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018 Team LibreELEC (https://libreelec.tv)

mkdir -p $RELEASE_DIR/3rdparty/bootloader
cp -a $INSTALL/usr/share/bootloader/aml_autoscript $RELEASE_DIR/3rdparty/bootloader/
cp -a $INSTALL/usr/share/bootloader/uEnv.ini $RELEASE_DIR/3rdparty/bootloader/
#cp -a $INSTALL/usr/share/bootloader/device_trees/meson-gxl-s905d-phicomm-n1.dtb $RELEASE_DIR/3rdparty/bootloader/dtb.img
cp -a $INSTALL/usr/share/bootloader/device_trees/gxm_q201_2g.dtb $RELEASE_DIR/3rdparty/bootloader/dtb.img

echo "Making ramdisk uInitrd..."
$TOOLCHAIN/bin/mkimage -C none -T ramdisk -A arm64 -d $INSTALL/../initramfs.cpio $RELEASE_DIR/3rdparty/bootloader/uInitrd
cp -a $RELEASE_DIR/3rdparty/bootloader/uInitrd $INSTALL/usr/share/bootloader/
